package com.mccree.controller;

import com.pojo.User;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
public class HelloController {

    @ApiOperation("测试接口")
    @ResponseBody
    @PostMapping("/test")
    public User test(User user){
        System.out.println(user.getName()+"----------"+user.getPassword());
        return user;
    }

    @GetMapping("/hello")
    @ResponseBody
    public String hello(){
        return "HelloSwagger!";
    }
    @GetMapping("/getUser")
    @ResponseBody
    public User getUser(){
        return new User();
    }
    @ApiOperation("mccree的接口")
    @PostMapping("/mccree")
    @ResponseBody
    public User mccree(@RequestBody User user){
        return user;
    }

    @GetMapping("/getmccree2/{num}")
    @ResponseBody
    public String getmccree2(@PathVariable("num")@ApiParam("测试") String num){
        return num;
    }
}
